package com.gxa.modules.service.impl;

import com.gxa.common.vo.JsonResult;
import com.gxa.modules.mapper.BankAccountMapper;
import com.gxa.modules.pojo.Bank_Account;
import com.gxa.modules.service.BankAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class BankAccountServiceImpl implements BankAccountService {
    @Autowired(required = false)
    private BankAccountMapper bankAccountMapper;
    @Override
    public JsonResult queryBankAccount(Integer page ,Integer limit) {
        JsonResult jsonResult = new JsonResult();
        Integer param1 = (page - 1)*limit;
        Integer param2 = limit;
        List<Bank_Account> bank_accountList = bankAccountMapper.queryBankAccountZ(param1,param2);
        int result = bankAccountMapper.countBankAccountZ();
        jsonResult.setCount(result);
        jsonResult.setData(bank_accountList);
        jsonResult.setCode(200);
        jsonResult.setMsg("查询成功");
        return jsonResult;
    }

    @Override
    public JsonResult updataBankAccount(Bank_Account bank_account) {

        bankAccountMapper.updataBankAccount(bank_account);

        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode(200);
        jsonResult.setMsg("修改成功！");
        return jsonResult;
    }

    @Override
    public JsonResult addBankAccount(Bank_Account bank_account) {
        bankAccountMapper.addBankAccount(bank_account);
        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode(200);
        jsonResult.setMsg("添加成功！");
        return jsonResult;
    }

    @Override
    public JsonResult delBankAccount(Bank_Account bank_account) {
        bankAccountMapper.delBankAccount(bank_account);
        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode(200);
        jsonResult.setMsg("删除成功！");
        return jsonResult;
    }
}
